package seatechit.msbgateway.dbaccess.dao.impl;

import java.sql.ResultSet;
import java.util.ArrayList;

import seatechit.msbgateway.dbaccess.SpringFrameworkDAO;
import seatechit.msbgateway.dbaccess.dao.HostTranCodeInfoDAO;
import seatechit.msbgateway.dbaccess.entity.HostTranCodeInfo;

public class HostTranCodeInfoDAOImpl extends SpringFrameworkDAO implements HostTranCodeInfoDAO {

	public HostTranCodeInfoDAOImpl() {
	}

	@Override
	public ArrayList<HostTranCodeInfo> getAllHostTranCodeInfo() {
		ResultSet rs = null;
		HostTranCodeInfo obj = null;
		ArrayList<HostTranCodeInfo> arrHostTranCodeInfo = new ArrayList<HostTranCodeInfo>();
		try {
			StringBuffer buffSQL = new StringBuffer();
			buffSQL.append("SELECT a.auto_id, a.ref_host_tran_code, a.real_host_tran_code,a.needsynchronized, a.description FROM bec_hostmsg a");
			rs = executeForQuery(buffSQL.toString());
			while (rs != null && rs.next()) {
				obj = new HostTranCodeInfo(rs.getString("auto_id"), rs.getString("ref_host_tran_code"), rs.getString("real_host_tran_code"), rs.getString("needsynchronized"), rs
						.getString("description"));
				arrHostTranCodeInfo.add(obj);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return arrHostTranCodeInfo;
	}
}
